<?php
//dodeleteappt.php
//Deletes appartment

require_once("../functions.php");
require_once("../database.php");

session_start();
if(!user_admin()){
  header('location: ../index.php');
  exit;
}

if($_GET && isset($_GET['id']) && is_numeric($_GET['id']) && isset($_GET['city']) && is_numeric($_GET['city'])){

  // Safe-ify ID
  $safe_id = sql_escape($_GET['id']);
  
  // Delete user
  query_delete_by_id("apartment", $safe_id);
  
  
  header('location: ../city.php?id=' . sql_escape($_GET['city']));
  exit;
}

header('location: ../index.php');


?>